<template>
  <div class="another">
    <div class="header">
      <!-- 轮播图 -->
      <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
        <van-swipe-item
          v-for="pics in anotherData.currentCategory
            ? anotherData.currentCategory.bannerList
            : []"
          :key="pics.picUrl"
        >
          <img :src="pics.picUrl" alt="" />
        </van-swipe-item>
      </van-swipe>
    </div>
    <div class="goods">
      <div class="title">
        {{
          anotherData.categoryItemList
            ? anotherData.categoryItemList[0].category.frontName
            : ""
        }}
      </div>
      <div class="subTitle">
        {{
          anotherData.categoryItemList
            ? anotherData.categoryItemList[0].category.name
            : ""
        }}
      </div>
      <!-- list组件 -->
      <van-list :finished="finished" finished-text="没有更多了" >
        <div class="detail" v-for="dea in props.rightList" :key="dea.id">
          <img :src="dea.listPicUrl" alt="" />
          <div class="letter">{{ dea.name }}</div>
          <div class="price">￥{{ dea.retailPrice }}</div>
        </div>

      </van-list>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reqAnotherData } from "@/api/home/an0ther";
import { ref } from "@vue/reactivity";
import { onMounted } from "@vue/runtime-core";

const props = defineProps(["rightList"]);

// 数据
const anotherData = ref<any>([]);
const loading = ref(false);
const finished = ref(false);

// 发送请求获取数据
const getData = async () => {
  const res = await reqAnotherData();
  anotherData.value = res.data;
  finished.value = true;
};

onMounted(() => {
  getData();
});
</script>

<style lang="less" scoped>
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
.another {
  width: 100%;
  height: 100%;
  .header {
    height: 187px;
    width: 100%;
    margin-top: 100px;
    //  轮播图
    .my-swipe {
      height: 187px;
      .my-swipe .van-swipe-item {
        color: #fff;
        font-size: 20px;
        line-height: 150px;
        text-align: center;
      }
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  //商品详情
  .goods {
    padding: 10px 0;
    margin-bottom: 50px;
    padding: 10px;
    .title {
      font-size: 18px;
      text-align: center;
    }
    .subTitle {
      font-size: 13px;
      text-align: center;
      color: gray;
      padding-top: 4px;
      padding: 10px 0;
    }

    .van-list {
      display: flex;
      flex-shrink: 0;
      flex-wrap: wrap;
      .detail {
        width: 160px;
        height: 210px;
        margin-left: 10px;
        margin-bottom: 10px;

        border-radius: 4px;
        img {
          width: 160px;
          height: 160px;
          border-radius: 10px;
        }
        .letter {
          font-size: 10px;
        }
        .price {
          text-indent: 20px;
          font-size: 16px;
          color: red;
        }
      }
    }
  }
}

//深度选择器
:deep(.van-swipe__indicator) {
  width: 30px;
  height: 3px;
  border-radius: 0;
}

:deep(.van-list__finished-text) {
  color: rgb(184, 184, 185);
  font-size: 20px;
  flex-shrink: 0;
  padding-left: 60px;
  padding-top: 140px;
}
</style>